import java.util.Arrays;
import java.util.HashSet;

/**
 * @Author liangzai
 * @Description:
 */
public class Main {
    //扩散
    static int count = 0;
    static HashSet<String> set = new HashSet<>();
    public static void main1(String[] args) {
        System.out.println(set.size());
        int[] a = {0,0};
        Count(a);
        int[] b = {11,14};
        Count(b);
        int[] c = {2020,11};
        Count(c);
        int[] d = {2000,2000};
        Count(d);
        System.out.println(set.size());
        System.out.println(count);
    }

    private static void Count(int[] nums) {
        int[] tmp = new int[2];
//		int[] tmp2 = Arrays.copyOf(nums, 2);
//		int[] tmp3 = Arrays.copyOf(nums, 2);
//		int[] tmp4 = Arrays.copyOf(nums, 2);
        //set.add(Arrays.toString(nums));
        for (int i = 0; i <= 2020; i++) {
            for (int j = 0; j <= 2020-i; j++) {
                tmp[0] = i+nums[0];
                tmp[1] = j+nums[1];
                set.add(Arrays.toString(tmp));
                if(!set.contains(Arrays.toString(tmp))){
                    //System.out.println(Arrays.toString(tmp));
                    set.add(Arrays.toString(tmp));
                    count++;
                }
                tmp[0] = nums[0]+i;
                tmp[1] = nums[1]-j;
                set.add(Arrays.toString(tmp));
                if(!set.contains(Arrays.toString(tmp))){
                    set.add(Arrays.toString(tmp));
                    count++;
                }
                tmp[0] = nums[0]-i;
                tmp[1] = nums[1]-j;
                set.add(Arrays.toString(tmp));
                if(!set.contains(Arrays.toString(tmp))){
                    set.add(Arrays.toString(tmp));
                    count++;
                }
                tmp[0] = nums[0]-i;
                tmp[1] = nums[1]+j;
                set.add(Arrays.toString(tmp));
                if(!set.contains(Arrays.toString(tmp))){
                    set.add(Arrays.toString(tmp));
                    count++;
                }
            }
        }
    }

    public static void main2(String[] args) {
        int sum = 0;
        for (int i = 1; i <= 4040; i+=2) {
            sum += i;
        }
        System.out.println(sum*2*4);
    }



//	static int[][] sum = {{0,0},{2020,11},{11,14},{2000,2000}};
//
//    public static void main(String[] args) {
//        int count = 0;
//    //遍历经过2020分钟后,上下左右能影响到的最大范围坐标
//        for(int i=-2020;i<=4040;i++) {//最左边的是0-2020 最右边2020+2020
//            for(int j=-2020;j<=4020;j++) {//最下面的是0-2020 最上面2000+2020
//                if (isBlack(i, j)) {
//                    count++;
//                }
//            }
//        }
//        System.out.println(count);
//    }
//
//    public static boolean isBlack(int x, int y) {
//        for(int[] num : sum) {//遍历sum并拿到每一个黑点坐标
//      //判断在影响范围内的坐标跟每一个黑点的距离,小于2020就是黑的
//            if (Math.abs(x - num[0]) + Math.abs(y - num[1]) <= 2020) {
//                return true;
//            }
//        }
//        return false;
//    }

    //本质上升序列
    public static void main(String[] args) {
        int count = 0;
        HashSet<String> set = new HashSet<>();
        String string = "lanqiao";
        for (int i = 0; i < string.length(); i++) {
            StringBuffer stringBuffer = new StringBuffer();
            stringBuffer.append(string.charAt(i));
            set.add(stringBuffer.toString());
            System.out.println(stringBuffer.toString());
            count++;
            char pcur = string.charAt(i);
            for (int j = i+1; j < string.length(); j++) {
                if(pcur<string.charAt(j)) {
                    stringBuffer.append(string.charAt(j));
                    set.add(stringBuffer.toString());
                    System.out.println(stringBuffer.toString());
                    count++;
                    pcur = string.charAt(j);
                }
//				if(string.charAt(j)=='z') {
//					break;
//				}
            }
        }
        System.out.println(set.size());
        //System.out.println(count);
        System.out.println(5137);
    }
}
